<template>
    <view>
        <view>
            <!-- <component :is="component"></component> -->
            <index v-show="currentTabIndex==0"></index>
            <timeimagesles v-show="currentTabIndex==1"></timeimagesles>
            <mine v-show="currentTabIndex==2"></mine>
        </view>
        <!-- <u-tabbar v-model="currentTabIndex"
                  @change="changeTab"
                  active-color="#63B9F2"
                  :list="tabbar[currentLoginIndex]"></u-tabbar> -->
        <u-tabbar v-if="loginType == 'parent'"
                  v-model="currentTabIndex"
                  @change="changeTab"
                  active-color="#63B9F2"
                  :list="parentList"></u-tabbar>
        <u-tabbar v-if="loginType == 'teacher'"
                  v-model="currentTabIndex"
                  @change="changeTab"
                  active-color="#63B9F2"
                  :list="teacherList"></u-tabbar>
    </view>
</template>

<script>
import index from '@/pages/index/index.vue'
import timeimagesles from '@/pages/timeimagesles/timeimagesles.vue'
import mine from '@/pages/mine/mine.vue'
export default {
    data() {
        return {
            loginType: '',
            currentTabIndex: 0,
            parentList: [
                {
                    pagePath: "/pages/index/index",
                    iconPath: "/static/images/nav_icon_sy_nor@2x.png",
                    selectedIconPath: "/static/images/nav_icon_sy_sel@2x.png",
                    text: "首页"
                },
                {
                    pagePath: "/pages/timeimagesles/timeimagesles",
                    iconPath: "/static/images/nav_icon_kcb_nor@2x.png",
                    selectedIconPath: "/static/images/nav_icon_kcb_sel@2x.png",
                    text: "课程表"
                },
                {
                    pagePath: "/pages/mine/mine",
                    iconPath: "/static/images/nav_icon_wd_nor@2x.png",
                    selectedIconPath: "/static/images/nav_icon_wd_sel@2x.png",
                    text: "我的"
                },
            ],
            teacherList: [
                {
                    pagePath: "/pages/timeimagesles/timeimagesles",
                    iconPath: "/static/images/nav_icon_kcb_nor@2x.png",
                    selectedIconPath: "/static/images/nav_icon_kcb_sel@2x.png",
                    text: "课程表"
                },
                {
                    pagePath: "/pages/mine/mine",
                    iconPath: "/static/images/nav_icon_wd_nor@2x.png",
                    selectedIconPath: "/static/images/nav_icon_wd_sel@2x.png",
                    text: "我的"
                },
            ],
        }
    },
    components: {
        index, timeimagesles, mine
    },
    onLoad() {
        this.loginType = uni.getStorageSync('loginType')
        if (this.loginType == 'parent') {
            this.currentTabIndex = 0
        } else if (this.loginType == 'teacher') {
            this.currentTabIndex = 1
        }
    },
    watch: {
        loginType(newV) {
            if (newV == 'parent') {
                this.currentTabIndex = 0
            } else if (newV == 'teacher') {
                this.currentTabIndex = 1
            }
        }
    },
    computed: {
    },
    methods: {
        changeTab(index) {
            this.currentTabIndex = index
        },
    }
}
</script>

<style>
</style>
